package com.jqd.framework.core.exception;

public class DAOException extends ApplicationException {
	
	private static final long serialVersionUID = -6581507208693326198L;
	
	
	public DAOException() {
		super();
	}
	
	
	public DAOException(String msg) {
		super(msg);
	}
	
	
	public DAOException(Throwable cause) {
		super(cause);
	}
	
	
	public DAOException(String msg, Throwable cause) {
		super(msg, cause);
	}
	
	
	public DAOException(String txnID, String className, String methodName, String msg,
			Throwable cause) {
		super(txnID, className, methodName, msg, cause);
	}
	
	
	public DAOException(String className, String methodName, String msg, Throwable cause) {
		super(className, methodName, msg, cause);
	}
	
	
	public DAOException(String className, String methodName, String msg) {
		super(className, methodName, msg);
	}
	
	
	@SuppressWarnings("rawtypes")
	public boolean contains(Class exClass) {
		if (exClass == null) {
			return false;
		}
		Throwable ex = this;
		while (ex != null) {
			if (exClass.isInstance(ex)) {
				return true;
			}
			if (ex instanceof DAOException) {
				ex = ((DAOException) ex).getCause();
			}
			else {
				ex = null;
			}
		}
		return false;
	}
	
}
